home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 26 / AACD 26.iso / AACD / Games / WHDLoad / Src / sources / whdload / blitfix_imm_58a0.s < prev    next >
Encoding:
Text File  |  2000-08-07  |  1.8 KB  |  78 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Modul.    blitfix_imm_58a0.s
  3. ;  :Contents.    routine to fix program that does not correctly wait for
  4. ;        blitter finish
  5. ;        the instruction which writes the "bltsize" register will be
  6. ;        patched with a routine which will wait for blitter finish
  7. ;        after writing "bltsize"
  8. ;  :Version.    $Id: blitfix_imm_58a0.s 1.4 2000/04/16 16:46:17 jah Exp $
  9. ;  :History.    15.03.99 generated from blitfix_imm_58a5.s
  10. ;        19.03.99 checked area fixed, a2 now returns pointer
  11. ;        09.04.00 interrupt blit check added
  12. ;  :Requires.    -
  13. ;  :Copyright.    Public Domain
  14. ;  :Language.    68000 Assembler
  15. ;  :Translator.    Barfly V1.131
  16. ;  :To Do.
  17. ;---------------------------------------------------------------------------*
  18. ;
  19. ; this will patch the following instruction:
  20. ;        move.w    #XXXX,($58,a0)
  21. ;
  22. ; IN:    A0 = APTR start of memory to patch
  23. ;    A1 = APTR end of memory to patch
  24. ;    A2 = APTR space for patch routine MUST be < $8000 !!!
  25. ; OUT:    D0-D1/A0-A1 unchanged
  26. ;    A2 = APTR points to the end of patch routine
  27.  
  28. _blitfix_imm_58a0
  29.         movem.l    a0-a1,-(a7)
  30.  
  31.     IFD PATCHCOUNT
  32.         clr.w    (6,a2)
  33.     ENDC
  34.  
  35.         subq.l    #4,a1
  36. .loop        cmp.w    #$317c,(a0)+        ;move.w #xxxx,($xxxx,a0)
  37.         bne    .next
  38.         cmp.w    #$0058,(2,a0)
  39.         bne    .next
  40.         move.w    (a0),(2,a0)        ;save blitsize
  41.         subq.w    #2,a0
  42.         move.w    #$4eb8,(a0)+        ;JSR $xxxx.w
  43.         move.w    a2,(a0)+
  44.  
  45.     IFD PATCHCOUNT
  46.         addq.w    #1,(6,a2)
  47.     ENDC
  48.  
  49. .next        cmp.l    a0,a1
  50.         bhs    .loop
  51.  
  52.         move.w    #$4ef9,(a2)+        ;JMP $xxxxxxxx.l
  53.         lea    .movewait,a0
  54.         move.l    a0,(a2)+
  55.  
  56.     IFD PATCHCOUNT
  57.         addq.w    #2,a2
  58.     ENDC
  59.  
  60.         movem.l    (a7)+,a0-a1
  61.         rts
  62.  
  63. .movewait    move.l    a1,-(a7)
  64.         move.l    (4,a7),a1
  65.         move.w    (a1)+,($58,a0)
  66.         move.l    a1,(4,a7)
  67.         move.l    (a7)+,a1
  68.         BLITWAIT a0
  69.     IFD INTBLITCHECK
  70.         move.l    d0,-(a7)
  71.         move    sr,d0
  72.         and.w    #$0700,d0
  73.         beq    .intok
  74.         illegal
  75. .intok        move.l    (a7)+,d0
  76.     ENDC
  77.         rts
  78.